<?php
/**
 * Created by PhpStorm.
 * User: zhangrongxiang
 * Date: 2017/5/31
 * Time: 上午10:01
 */


//如果对一个未定义的变量进行引用赋值、引用参数传递或引用返回，则会自动创建该变量。


function foo(&$var)
{
}

foo($a); // $a is "created" and assigned to null

$b = array();
foo($b['b']);
var_dump(array_key_exists('b', $b)); // bool(true)

$c = new StdClass;
foo($c->d);
var_dump(property_exists($c, 'd')); // bool(true)

echo PHP_EOL;
echo is_null($c->d);


$c->d = 10;
echo PHP_EOL;
echo $c->d;

$c2 = $c;
echo PHP_EOL;
echo $c2->d;
$c2->d = 11;

echo PHP_EOL;
echo $c->d;